import cx_Oracle
formatString = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)" +"(HOST=%s)(PORT=%d)))(CONNECT_DATA=(SID=%s)))"
args = ("192.168.1.245", 1521, "kaible")
result = cx_Oracle.makedsn(*args)

ora = cx_Oracle.connect("kaible","kaible",result)
curs = ora.cursor()
curs.execute('select * from wapproduct where rownum<1234')

row = curs.fetchone()

while row:
    print row[0],row[1]
    row = curs.fetchone()

print 'end'    

curs.close()
ora.close()